﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using nplJobsCommon.JobSeeker;
using System.Data.SqlClient;

namespace nplJobsDAL.Insert
{
    /// <summary>
    /// This class is used to insert job seeker's data
    /// </summary>
    public class InsertJobSeekerLastUpdate : DataAccessBase
    {
        public Guid lastJobSeekerID;
        public string CheckUnique;
        
        public JobSeeker JobSeeker { get; set; }

        public InsertJobSeekerLastUpdate()
        {
            StoredProcedureName = StoredProcedure.Name.spInsertJobSeekerLastUpdate.ToString();
        }

        public void Insert()
        {
            InsertJobSeekerLastUpdateDataParameters contactInsertDataParameters = new InsertJobSeekerLastUpdateDataParameters(this.JobSeeker);
            DataBaseHelper dbHelper = new DataBaseHelper(StoredProcedureName);
            dbHelper.Parameters = contactInsertDataParameters.Parameters;
            object LastJobSeekerID = dbHelper.RunScalar();
        }
    }

    #region SQL parameters for Job seeker insert data
    public class InsertJobSeekerLastUpdateDataParameters
    {      
        public int CkeckUnique;
        private SqlParameter[] _parameters;
        private SqlParameter[] _insertParam;
        public int lastJobSeekerID;

        public InsertJobSeekerLastUpdateDataParameters(JobSeeker jobSeeker)
        {
            this.JobSeeker = jobSeeker;
            Build();
        }

        private void Build()
        {
            SqlParameter[] parameters = 
                {
                    new SqlParameter("@JobSeekerID", JobSeeker.JobSeekerID),
                };

            Parameters = parameters;


            //SqlParameter[] insertParam = 
            //    {
                   
            //        new SqlParameter("@FirstName", JobSeeker.FirstName),
            //        new SqlParameter("@LastName", JobSeeker.LastName),
            //        new SqlParameter("@DOB", JobSeeker.DOB),
            //        new SqlParameter("@NationalityID", JobSeeker.NationalityID),
            //        new SqlParameter("@AboutMe", JobSeeker.AboutMe),
            //        new SqlParameter("@Email", JobSeeker.Email),
            //         new SqlParameter("@GenderID", JobSeeker.GenderID),
            //        new SqlParameter("@PresentAddress", JobSeeker.PresentAddress),
            //        new SqlParameter("@MobilePhone", JobSeeker.MobilePhone),
                  
            //    };

            //_insertParam = insertParam;
        }

        public JobSeeker JobSeeker { get; set; }

        public SqlParameter[] Parameters
        {
            get { return _parameters; }
            set { _parameters = value; }
        }

        public SqlParameter[] InsertParam
        {
            get { return _insertParam; }
            set { _insertParam = value; }
        }
    }
    #endregion
}
